﻿using System;

namespace Program11
{
    //枚举类型
    public enum QQstar
    {
        online = 1,
        offline = 2,
        leave = 3,
        busy = 4,
        Qme = 5
    }
    class Program
    {
        static void Main(string[] args)
        {
            QQstar state = QQstar.offline;
            int n = (int)state;
            Console.WriteLine("QQ在线枚举成员的值:{0}", n);
            Console.WriteLine("QQ在线枚举成员的值:{0}", (int)QQstar.online);
            Console.WriteLine("QQ在线枚举成员的值:{0}", (int)QQstar.leave);
            Console.WriteLine("QQ在线枚举成员的值:{0}", (int)QQstar.busy);
            Console.WriteLine("QQ在线枚举成员的值:{0}", (int)QQstar.Qme );
            Console.WriteLine("QQ在线枚举成员的值:{0}", (QQstar)1);


            //将字符串转换为枚举类型(重点)
            //将 online 转换成QQstar的"online"
            string s = "online";
            QQstar Q = (QQstar)Enum.Parse(typeof(QQstar), s);
            Console.WriteLine(Q);
            Console.WriteLine((int)Q);

        }
    }
}
